﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Microhard.Framework.MVCHelper" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    卖场维护
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
            卖场维护
        </div>
        <div class="options">
        </div>
    </div>
    <table width="100%">
        <tr>
            <td class="adminTitle">
                <img alt="集团" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="集团"></img><label
                    for="operationName" title="集团">集团</label>:
            </td>
            <td class="adminData">
                <%--会影响当前页面的Operation--%>
                <%Html.RenderAction("GetKAList", "FMCGTool", new { area = "Tools", ctrAttr = new Microhard.WebUI.Models.AttriubteOfSelectList { ParameterModelName = "SelectedKAID", IsMulitiplySelect = false, DefaultSelectedText = "请选择", DefaultSelectedValue = Guid.Empty.ToString() } });%>
            </td>
        </tr>
    </table>
    <p>
    </p>
    <table class="adminContent">
        <tr>
            <td>
                <%Html.Telerik().Grid<Micrhard.FMCG.Server.Models.SubKAModel>((List<Micrhard.FMCG.Server.Models.SubKAModel>)this.Model.Data)
                    .Name("operation-grid")
                    .ToolBar(t => t.Template(g =>
                    { %>
                <%var searchParms = new Dictionary<string, string>();
                  searchParms.Add("KAID", "SelectedKAID");
                %>
                <div class="header-menu">
                    <ul class="t-widget t-reset t-header t-menu">
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_SearchButton("btnSearch", "查询", "operation-grid", searchParms, "OperationGridOnGridDataBinding")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_AddButton("btnAdd", "添加", "Create", "SubKA")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnUpdate", "修改", "operation-grid", "Update", "SubKA", "FMCGClient")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_DeleteButton("btnDelete", "删除", "operation-grid", "Delete", "SubKA", "FMCGClient")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnAssign", "分配", "operation-grid", "Assign", "SubKA", "FMCGClient")%>
                        </li>
                    </ul>
                </div>
                <%}))
                         .ClientEvents(events => events.OnDataBinding("OperationGridOnGridDataBinding"))
                         .Columns(columns =>
                    {
                        columns.Bound(x => x.SubID)
                       .Template(x => Html.CheckBox("checkedRecords", new { value = x.SubID, @class = "gridCks" }))
                       .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= SubID #>' class='gridCks'/>")
                     .HtmlAttributes(new { style = "text-align:center" }).Title("选择");

                        columns.Bound(x => x.CustomerCode).Title("编码");
                        columns.Bound(x => x.Name).Title("名称");
                        columns.Bound(x => x.Contractor).Title("客户联系人");
                        columns.Bound(x => x.Cellphone).Title("客户联系方式");
                        columns.Bound(x => x.MonitorNames).Title("业务员");
                        columns.Bound(x => x.SalerNames).Title("促销员");
                        columns.Bound(x => x.ProvinceDisplayTxt).Title("省份");
                        columns.Bound(x => x.CityDisplayTxt).Title("城市");
                        columns.Bound(x => x.Address).Title("地址");
                        columns.Bound(x => x.SubID)
                    .Template(x => Html.ActionLink("设置", "SetLocation", "SubKA", new { identity = x.SubID, target = "blank" }, new { style = x.DisplayCSS }))
                    .ClientTemplate("<a href='#' onclick=setLocation('<#= SubID #>')  style=<#= DisplayCSS #>>设置</a>")
                    .HtmlAttributes(new { style = "text-align:center" }).Title("位置");
                    })
                      .Pageable(settings => settings.Total(Model.Total).PageSize(Html.GetGridPageSize()).Position(GridPagerPosition.Top))
                      //绑定搜索按钮，执行对应的action
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("_List", "SubKA"))
                    .EnableCustomBinding(true)
                    .Render();
                %>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        function setLocation(id) {
           var url = "<%=Url.Content("~/FMCGClient/SubKA/SetLocation?identity=")%>" + id;
           window.open(url,"设置门店位置");
        }
    </script>
</asp:Content>
